STEP 4: Let's calculate the circle's area. A circle's area is πr2, so we need to create a variable to store this value.

  • In the LOGIC tab, click on and drag out Float Variable right underneath my_circle.
  • Change the variable name from my_var to circle_area.
  • Change the value of circle_area from 2.34 to the equation 3.14 * (25/2) ** 2.

3.14 is the value of π, the radius is our diameter divided by 2, and ** 2 is how to square a number in Python!

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)